package com.yanqu.road.server.manger.player;

import com.yanqu.road.dao.impl.player.InnerUserBlackDaoImpl;
import com.yanqu.road.server.TempMgr;
import com.yanqu.road.utils.ConfigHelper;
import io.netty.util.internal.ConcurrentSet;

import java.util.Set;

public class InnerUserMgr extends TempMgr {

    private static Set<Long> blackList = new ConcurrentSet<>();

    @Override
    public boolean init() throws Exception {
        return reload();
    }

    @Override
    public boolean reloadConfig() throws Exception {
        return true;
    }

    @Override
    public boolean reloadData() throws Exception {
        long serverId = ConfigHelper.getLong("serverId");
        blackList = new InnerUserBlackDaoImpl().getInnerUserBlacklistMap(serverId);
        return true;
    }

    @Override
    public boolean stop() {
        return false;
    }

    public boolean isInnerBlack(long userId){
        return blackList.contains(userId);
    }
}
